Micron Document




Datafly algorithm
part 4/5 · 7.1 KB total
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
// Construct a frequency list containing unique sequences of values across the quasi-identifier in PT,

// along with the number of occurrences of each sequence.

1. let freq be an expandable and collapsible vector with no elements initially. Each element is of the form ( QI, frequency, SID ), where SID = { idi : ∃ t[id] ∈ [id] ⇒ t[id] = idi }; and, frequency = |SID|. Therefore, freq is also accessible as a table over (QI, frequency, SID).

2. let pos ← ← {\displaystyle \gets } 0, total ← ← {\displaystyle \gets } 0

3. while total ≠ |PT| do

3.1 freq[pos] ← ← {\displaystyle \gets } ( t[QI], occurs, SID ) where t[QI] ∈ [QI], ( t[ QI ],__, ___ ) ∉ {\displaystyle \not \in } freq; occurs = |PT| - |PT[QI] – {t[QI]}|; and, SID = { idi : ∃ t[id] ← ← {\displaystyle \gets } PT[id] ⇒ t[id] = idi }

3.2 pos ← ← {\displaystyle \gets } pos + 1, total ← ← {\displaystyle \gets } total + occurs

// Make a solution by generalizing the attribute with the most number of distinct values

// and suppressing no more than the allowed number of tuples.

4. let belowk ← ← {\displaystyle \gets } 0

5. for pos ← ← {\displaystyle \gets } 1 to |freq| do

5.1 ( __, count ) ← ← {\displaystyle \gets } freq[pos]

5.2 if count < k then do

5.2.1 belowk ← ← {\displaystyle \gets } belowk + count

6. if belowk > k then do: // Note. loss * |PT| = k.

6.1 freq ← ← {\displaystyle \gets } generalize(freq)

6.2 go to step 4

7. else do

// assert: the number of tuples to suppress in freq is ≤ loss * |PT|

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────